﻿using Management.Systeam.Domaina;
using Management.Systeam.ErrorCode;
using Management.Systeam.Read.Apis.Application.Command.InventoryAudits;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Management.Systeam.Read.Apis.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InventoryAuditsAllController : ControllerBase
    {
        IMediator mediator;

        public InventoryAuditsAllController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public async Task<ApiPeaging<ApiResult<List<InventoryAudit>>>> ShowInventoryAudit([FromQuery] ShowInventoryAuditsCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<InventoryAudit>> FistInventoryAudit([FromQuery] FirstInventoryAuditsCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public async Task<ApiResult<int>> DelAllInventoryAudit( [FromQuery] DeleteAllInventoryCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
